package com.xiongwei.myspringbootproject.dao;

import com.xiongwei.myspringbootproject.domain.ProductZKH;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author XiongWei
 * @date 2021/9/23
 */
@Repository
public interface ProductZKHDao extends JpaRepository<ProductZKH, Long> {

    @Query(value = "select id, code, SUBSTRING_INDEX(name, \" \", 2) name, spec, category, brand, keyword from product_zkh", nativeQuery = true)
    List<ProductZKH> getNameList();

    @Query(value = "select * from product_zkh limit 10", nativeQuery = true)
    List getsss();

    List findAllByBrandLike(String s);

    List findAllByBrandCn(String brandCn);
}
